/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entidades;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author ccedeno
 */
@Entity
@Table(name = "his_mov_reg", catalog = "emilima_tradoc", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "HisMovReg.findAll", query = "SELECT h FROM HisMovReg h"),
    @NamedQuery(name = "HisMovReg.findByIdHisMovReg", query = "SELECT h FROM HisMovReg h WHERE h.idHisMovReg = :idHisMovReg"),
    @NamedQuery(name = "HisMovReg.findByOperacion", query = "SELECT h FROM HisMovReg h WHERE h.operacion = :operacion"),
    @NamedQuery(name = "HisMovReg.findByFecha", query = "SELECT h FROM HisMovReg h WHERE h.fecha = :fecha"),
    @NamedQuery(name = "HisMovReg.findByTabla", query = "SELECT h FROM HisMovReg h WHERE h.tabla = :tabla"),
    @NamedQuery(name = "HisMovReg.findByObservacion", query = "SELECT h FROM HisMovReg h WHERE h.observacion = :observacion"),
    @NamedQuery(name = "HisMovReg.findByResMd5", query = "SELECT h FROM HisMovReg h WHERE h.resMd5 = :resMd5")})
public class HisMovReg implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "id_his_mov_reg", nullable = false)
    private Integer idHisMovReg;
    @Size(max = 45)
    @Column(name = "operacion", length = 45)
    private String operacion;
    @Column(name = "fecha")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecha;
    @Size(max = 45)
    @Column(name = "tabla", length = 45)
    private String tabla;
    @Size(max = 45)
    @Column(name = "observacion", length = 45)
    private String observacion;
    @Size(max = 32)
    @Column(name = "res_md5", length = 32)
    private String resMd5;
    @JoinColumn(name = "fk_resp", referencedColumnName = "id_responsable", nullable = false)
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Trabajador trabajador;

    public HisMovReg() {
    }

    public HisMovReg(Integer idHisMovReg) {
        this.idHisMovReg = idHisMovReg;
    }

    public Integer getIdHisMovReg() {
        return idHisMovReg;
    }

    public void setIdHisMovReg(Integer idHisMovReg) {
        this.idHisMovReg = idHisMovReg;
    }

    public String getOperacion() {
        return operacion;
    }

    public void setOperacion(String operacion) {
        this.operacion = operacion;
    }

    public Date getFecha() {
        return fecha;
    }

    public void setFecha(Date fecha) {
        this.fecha = fecha;
    }

    public String getTabla() {
        return tabla;
    }

    public void setTabla(String tabla) {
        this.tabla = tabla;
    }

    public String getObservacion() {
        return observacion;
    }

    public void setObservacion(String observacion) {
        this.observacion = observacion;
    }

    public String getResMd5() {
        return resMd5;
    }

    public void setResMd5(String resMd5) {
        this.resMd5 = resMd5;
    }

    public Trabajador getTrabajador() {
        return trabajador;
    }

    public void setTrabajador(Trabajador trabajador) {
        this.trabajador = trabajador;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idHisMovReg != null ? idHisMovReg.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof HisMovReg)) {
            return false;
        }
        HisMovReg other = (HisMovReg) object;
        if ((this.idHisMovReg == null && other.idHisMovReg != null) || (this.idHisMovReg != null && !this.idHisMovReg.equals(other.idHisMovReg))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entidades.HisMovReg[ idHisMovReg=" + idHisMovReg + " ]";
    }
}
